// 提交问卷答案
const conn = require("./conn.js")


module.exports = (req, res) => {
    setTimeout(() => {
        //获取参数变量
        let content = req.body.content,
            item = req.body.item,
            cuid = req.body.cuid,
            paper_id = req.body.paper_id,
            note = req.body.note,
            title = req.body.title,
            // 将数据插入数据库
            sql = 'insert into `answer` set ?'
        conn.query(sql, {
            content, item, paper_id,title,note,cuid
        }, function (error, result) {
            if (error == null) {
                res.json({
                    error: 0,
                    message: 'ok',
                })
            } else {
                console.log(result)
                res.json({
                    error: 1,
                    message: 'error'
                })
            }
        })
    }, 500)

}